package com.ktgj.customer.service.impl;

import com.ktgj.customer.domain.PassengerDocuments;
import com.ktgj.customer.mapper.PassengerDocumentsMapper;
import com.ktgj.customer.service.IPassengerDocumentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 常用旅客证件信息Service业务层处理
 */
@Service
public class PassengerDocumentsServiceImpl implements IPassengerDocumentsService
{
    @Autowired
    private PassengerDocumentsMapper passengerDocumentsMapper;

    /**
     * 新增常用旅客证件信息
     * */
    @Override
    public int insertPassengerDocuments(List<PassengerDocuments> passengerDocumentsList) {
        return passengerDocumentsMapper.insertPassengerDocuments(passengerDocumentsList);
    }

    /**
     * 根据乘车人id查询证件信息
     * */
    @Override
    public List<PassengerDocuments> selectDocumentsByCommontrvelersId(Long commontrvelersId) {
        List<PassengerDocuments> passengerDocuments = passengerDocumentsMapper.selectDocumentsByCommontrvelersId(commontrvelersId);
        if (passengerDocuments.size() > 0){
            return passengerDocuments;
        }
        else {
            return null;
        }
    }

    @Override
    public PassengerDocuments backSelectPassengerDocumentsBack(Long commontrvelersId) {
        return passengerDocumentsMapper.backSelectPassengerDocumentsBack(commontrvelersId);
    }
}
